package com.coolzeng.service.impl;

import com.coolzeng.dao.UserMapper;
import com.coolzeng.entity.User;
import com.coolzeng.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/6/5.
 */


@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public void AddUser(User record) {
        userMapper.insert(record);
    }

    /*根据id查询用户*/
    @Override
    public List<User> Getuser(int id) {
        return userMapper.selectByPrimaryKey(id);
    }

    //查询所有用户
    @Override
    public List<User> GetAllUser() {
        return userMapper.selectAllUser();
    }

    //根据id删除用户
    @Override
    public String DeleteUser(int id) {
        userMapper.deleteByPrimaryKey(id);
        return "";
    }

    @Override
    public User UpdateUser(User user) {
        userMapper.updateByPrimaryKey(user);
        return null;
    }

    @Override
    public User Login(int id) {


        return userMapper.login(id);
    }


    //登录验证



}
